package y23.Dec;

public class Test8 {
    public boolean repeatedSubstringPattern(String s) {
        StringBuffer str = new StringBuffer(s);
        for (int i = 1; i < str.length(); i++) {
            if (str.charAt(0) == str.charAt(i)){
                int count = 0;
                for (int j = i; j < str.length();j+=i) {
                    if (j+i > str.length()){
                        count++;
                        break;
                    }
                    if (!str.substring(0,i).equals(str.substring(j,j+i))){
                        count++;
                    }
                }
                if (count==0){
                    return true;
                }
            }
        }
        return false;
    }
}
